package com.g2.admin.common.constant;

public class RedisConstants {
    public static final long TIME_7DAYS = 7 * 3 * 3600;
    /**
     * 默认时长：3个小时
     */
    public static final long TIME_DEFAULT = 3 * 3600;
    /**
     * 5分钟时间
     */
    public static final long TIME_MIN_FIVE = 300;
    public static final long TIME_SECOND_FIVE = 5;

    public static final String KEY_CAPTCHA = "admin:captcha:%s";
    /**
     * TOKEN缓存KEY，值为userAccount对象（去掉了敏感信息）
     */
    public static final String KEY_TOKEN = "admin:token:%s";
    /**
     * 权限缓存KEY，值为权限的MAP，MAP的field为权限编码，值为权限后台访问路径的正则表达式
     */
    public static final String KEY_AUTH_PATH = "admin:auth:%s";

    public static String getKeyCaptcha(String uuid) {
        return String.format(KEY_CAPTCHA, uuid);
    }

    public static String getKeyToken(String token) {
        return String.format(KEY_TOKEN, token);
    }

    public static String getKeyAuthPath(String token) {
        return String.format(KEY_AUTH_PATH, token);
    }


}
